package com.wave12.pro_cart.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wave12.pro_cart.dao.CartDao;
import com.wave12.pro_cart.entity.Cart;
import com.wave12.pro_cart.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.common.Mapper;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

@Service
public class CartServiceImpl extends BaseServiceImpl<Cart> implements CartService {

   @Autowired
   CartDao cartDao;


    @Override
    protected Mapper<Cart> getMapper() {
        // TODO Auto-generated method stub
        return this.cartDao;
    }


    @Override
    public PageInfo<Cart> getMyCartList(int pageNo, int pageSize, String userId, String searchType, String keyword) {
        PageHelper.startPage(pageNo, pageSize);
        ArrayList<Cart> lstCart = cartDao.getMyCartList(userId, searchType, keyword);
        PageInfo<Cart> pageInfo = new PageInfo<Cart>(lstCart);
        return pageInfo;
    }
    
    
    @Override
    public Cart getOneProCartDetail() {
        return cartDao.getOneProCartDetail();
    }
}
